var t = require;
var e = module;
var o = exports;
var Adv_skd=require("./Adv_skd");
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("BootConst"),
    i = t("EventData"),
    s = t("GameData"),
    c = t("Util"),
    l = t("View"),
    u = t("WatchVideo"),
    p = t("ConfS"),
    f = t("fightManager"),
    d = t("fightView"),
    h = t("fun"),
    y = t("mainView"),
    g = t("topBar"),
    v = cc._decorator,
    m = v.ccclass,
    _ =
        (v.property,
        (function (t) {
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                return (e.res = "mate"), e;
            }
            var o;
            return (
                n(e, t),
                (o = e),
                (e.prototype.onEnable = function () {
                    Adv_skd.default.instance.showInterstitialAd();
                    this.hideView(g.default), 0 == o.datas.value.length && this.rdata();
                }),
                (e.prototype.rdata = function () {
                    for (var t = 0; t < 4; t++) o.datas.value[t] = h.getRdata(t);
                    o.datas.emit();
                }),
                (e.prototype.onClick = function (t, e) {
                    var n = this;
                    switch (t) {
                        case "close":
                            this.hideView(), this.showView(y.default);
                            break;
                        case "refresh":
                            u.default.show(a.dd.huanyipi, function () {
                                n.rdata();
                            });
                            break;
                        case "hero":
                            s.default.heros.includes(e) && s.default.hero != e && (s.default.hero = e);
                            break;
                        case "enemy":
                            (f.default.adata = o.datas.value[e]),
                                (o.datas.value[e] = null),
                                (f.default.playerdata = {
                                    herodata: p.DatasManager.HeroDatasById[s.default.hero],
                                    herolvs: s.default.herolvs,
                                    equips: s.default.equips
                                });
                            for (var r = this.rmap(); 106000101 == r.ID || 106000102 == r.ID; ) r = this.rmap();
                            (f.default.mapdata = r), cc.log(r), this.hideView(), this.showView(d.default);
                    }
                }),
                (e.prototype.rmap = function () {
                    return p.DatasManager.DituDatas[c.RandomInt(0, p.DatasManager.DituDatas.length - 1)];
                }),
                (e.datas = new i.default([])),
                (e = o = r([m], e))
            );
        })(l.default));
o.default = _;
